package com.pwser.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @RequestMapping("/")
    public String index() {
        return "Hello Docker!";
    }

    @RequestMapping("/count")
    public String count() {
        Long views = redisTemplate.opsForValue().increment("views");
        return "Hello Docker-Compose " + views;
    }
}
